﻿#ifndef NOTIFY_H
#define NOTIFY_H

#include <QWidget>
#include <QLabel>
#include <QMouseEvent>
#include <QPushButton>

/**
 * @brief  Notify 简单控件，支持显示带有 Icon 的消息框
 * @note   
 * @retval None
 * 
 * +-------------------------------+
 * |  +----+  Title               X|
 * |  |icon|                       |
 * |  +----+  Message............. |
 * +-------------------------------+
 */
class QNotify : public QWidget
{
    Q_OBJECT
public:
    explicit QNotify(int displayTime, QWidget *parent = 0);

    void setIcon(const QString &value);

    void setTitle(const QString &value);

    void setBody(const QString &value);

    void setUrl(const QString &value);

    void showGriant();

    float windowOpacity() const;
    void setWindowOpacity(float newWindowOpacity);

Q_SIGNALS:
    void disappeared();

private:

    int displayTime;
    float m_windowOpacity;

    QString icon;
    QString title;
    QString body;
    QString url;

    QLabel *backgroundLabel;
    QLabel *iconLabel;
    QLabel *titleLabel;
    QLabel *bodyLabel;


    QPushButton *closeBtn;

    void hideGriant();

    void mousePressEvent(QMouseEvent *event);
};

#endif // NOTIFY_H
